import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: wangxin
 * Date: 2024-08-09
 * Time: 17:00
 */
public class test3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] a = in.next().toCharArray();
        char[] b = in.next().toCharArray();
        int n = a.length;
        int m = b.length;
        int ret = n;
        for (int i = 0; i <= m-n; i++) {
            int tmp = 0;
            for (int j = 0; j < n; j++) {

                if(a[j] != b[i + j]){
                    tmp++;
                }
            }0
            ret = Math.min(ret,tmp);
        }
        System.out.println(ret);
    }
}
